home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / dev / lang / pcq12b.lzh / Include / Devices / SCSIDisk.i < prev    next >
Text File  |  1990-08-27  |  3KB  |  96 lines

  1. {
  2.     SCSIDisk.i for PCQ Pascal
  3.  
  4.     SCSI exec-level device command
  5. }
  6.  
  7. {--------------------------------------------------------------------
  8.  *
  9.  *   SCSI Command
  10.  *    Several Amiga SCSI controller manufacturers are converging on
  11.  *    standard ways to talk to their controllers.  This include
  12.  *    file describes an exec-device command (e.g. for hddisk.device)
  13.  *    that can be used to issue SCSI commands
  14.  *
  15.  *   UNIT NUMBERS
  16.  *    Unit numbers to the OpenDevice call have encoded in them which
  17.  *    SCSI device is being referred to.  The three decimal digits of
  18.  *    the unit number refer to the SCSI Target ID (bus address) in
  19.  *    the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  20.  *    and the controller board in the 100's digit.
  21.  *
  22.  *    Examples:
  23.  *          0    drive at address 0
  24.  *         12    LUN 1 on multiple drive controller at address 2
  25.  *        104    second controller board, address 4
  26.  *         88    not valid: both logical units and addresses
  27.  *            range from 0..7.
  28.  *
  29.  *   CAVEATS
  30.  *    Original 2090 code did not support this command.
  31.  *
  32.  *    Commodore 2090/2090A unit numbers are different.  The SCSI
  33.  *    logical unit is the 100's digit, and the SCSI Target ID
  34.  *    is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  35.  *    (7 is reserved for the controller).
  36.  *
  37.  *        Examples:
  38.  *          3    drive at address 0
  39.  *        109    drive at address 6, logical unit 1
  40.  *          1    not valid: this is not a SCSI unit.  Perhaps
  41.  *            it's an ST506 unit.
  42.  *
  43.  *    Some controller boards generate a unique name (e.g. 2090A's
  44.  *    iddisk.device) for the second controller board, instead of
  45.  *    implementing the 100's digit.
  46.  *
  47.  *    There are optional restrictions on the alignment, bus
  48.  *    accessability, and size of the data for the data phase.
  49.  *    Be conservative to work with all manufacturer's controllers.
  50.  *
  51.  *------------------------------------------------------------------}
  52.  
  53. Const
  54.  
  55.     HD_SCSICMD        = 28;    { issue a SCSI command to the unit }
  56.                 { io_Data points to a SCSICmd }
  57.                 { io_Length is sizeof(struct SCSICmd) }
  58.                 { io_Actual and io_Offset are not used }
  59.  
  60. Type
  61.  
  62.     SCSICmd = record
  63.     scsi_Data    : Address; { word aligned data for SCSI Data Phase }
  64.                    { (optional) data need not be byte aligned }
  65.                    { (optional) data need not be bus accessable }
  66.     scsi_Length    : Integer; { even length of Data area }
  67.                    { (optional) data can have odd length }
  68.                    { (optional) data length can be > 2**24 }
  69.     scsi_Actual    : Integer; { actual Data used }
  70.     scsi_Command    : Address; { SCSI Command (same options as scsi_Data) }
  71.     scsi_CmdLength    : Short;   { length of Command }
  72.     scsi_CmdActual    : Short;   { actual Command used }
  73.     scsi_Flags    : Byte;    { includes intended data direction }
  74.     scsi_Status    : Byte;       { SCSI status of command }
  75.     end;
  76.     SCSICmdPtr = ^SCSICmd;
  77.  
  78.  
  79. Const
  80.  
  81. {----- scsi_Flags -----}
  82.     SCSIF_WRITE        = 0;    { intended data direction is out }
  83.     SCSIF_READ        = 1;    { intended data direction is in }
  84.  
  85. {----- SCSI io_Error values -----}
  86.     HFERR_SelfUnit    = 40;    { cannot issue SCSI command to self }
  87.     HFERR_DMA        = 41;    { DMA error }
  88.     HFERR_Phase        = 42;    { illegal or unexpected SCSI phase }
  89.     HFERR_Parity    = 43;    { SCSI parity error }
  90.     HFERR_SelTimeout    = 44;    { Select timed out }
  91.     HFERR_BadStatus    = 45;    { status and/or sense error }
  92.  
  93. {----- OpenDevice io_Error values -----}
  94.     HFERR_NoBoard    = 50;    { Open failed for non-existant board }
  95.  
  96.